package com.sgb.kjwl.view.ui.adapter.transport;


import android.widget.ImageView;

import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.self.ProprietaryDriverEntity;
import com.sgb.kjwl.utils.DefaultUtil;

import java.util.List;

/**
 * @author: 杨畔
 * @date: 2021/10/9 11:02
 * @Description: 绑定司机列表适配器
 */
public class DriverBindAdapter extends BaseQuickAdapter<ProprietaryDriverEntity, BaseViewHolder> {
    public DriverBindAdapter(@Nullable List<ProprietaryDriverEntity> data) {
        super(R.layout.app_item_driver_bind, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ProprietaryDriverEntity item) {
        //头像
        Glide.with(mContext).load(DefaultUtil.getString(item.getHeadImg()))
                .placeholder(R.mipmap.morentu_person)
                .error(R.mipmap.morentu_person)
                .circleCrop()
                .into((ImageView) helper.getView(R.id.iv_avatar));
        //
        helper.setText(R.id.tv_name, DefaultUtil.getString(item.getName()))
                .setText(R.id.tv_phone, DefaultUtil.getString(item.getTelphone()))
                .addOnClickListener(R.id.tv_bind);
    }
}
